Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add date format to exported logs #71

Merged

Conversation

KCeh
Copy link
Collaborator

@KCeh KCeh commented Jul 7, 2024

📷 Screenshots

Screenshot_20240707_163138

📄 Context

As requested in #47 exported logs now have human-readable timestamp (same format as logcat). Also, to have the consistency I added same date-time format to the list of logs (and log files)

📝 Changes

Added date-time formating when writing logs to files. Changed date-time formatting in list of logs

🛠️ How to test

Try out sample app

And make them same as in logs list
@KCeh KCeh added the enhancement New feature or request label Jul 7, 2024
@KCeh KCeh requested a review from AsimRibo July 7, 2024 14:34
@KCeh KCeh self-assigned this Jul 7, 2024
@@ -21,6 +22,8 @@ internal class SentinelFileTree(
private val logFileResolver = LogFileResolver(context)

override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
val dateTimeFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss. SSSZ", Locale.getDefault())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm interpreting the screenshot correctly, this space seems unnecessary.

Suggested change
val dateTimeFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss. SSSZ", Locale.getDefault())
val dateTimeFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())


internal class LoggerAdapter(
private val onListChanged: (Boolean) -> Unit,
private val onClick: (SentinelFileTree.Entry) -> Unit
) : ListAdapter<SentinelFileTree.Entry, LoggerViewHolder>(LoggerDiffUtil()) {

private val dateTimeFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss. SSSZ", Locale.getDefault())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too, and it also makes me wonder if we could just share this pattern or formatted between the two files 😄

Suggested change
private val dateTimeFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss. SSSZ", Locale.getDefault())
private val dateTimeFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ", Locale.getDefault())

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, of course

Copy link
Collaborator

@JonatanPlesko JonatanPlesko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me, but best if someone with more knowledge of the library code looks into it as well. Nice to see this improvement! 👏

Copy link

@KCeh KCeh merged commit 1a5116c into develop Jul 12, 2024
6 checks passed
@KCeh KCeh deleted the feature/Parse-UNIX-timestamp-to-readable-date-in-exported-logs branch August 20, 2024 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants